<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>蓝色聊天界面</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
        }
        
        body {
            background-color: #f5f7fa;
            display: flex;
            justify-content: center;
            padding: 20px 0;
        }
        
        .chat-container {
            width: 750px;
            height: 100vh;
            max-height: 1200px;
            background-color: #fff;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
            display: flex;
            flex-direction: column;
        }
        
        .chat-header {
            background-color: #2196F3;
            color: white;
            padding: 18px 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        
        .chat-title {
            font-size: 20px;
            font-weight: 600;
        }
        
        .tab-switch {
            display: flex;
            background-color: rgba(255, 255, 255, 0.2);
            border-radius: 20px;
            padding: 4px;
        }
        
        .tab {
            padding: 6px 16px;
            border-radius: 16px;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .tab.active {
            background-color: white;
            color: #2196F3;
            font-weight: 500;
        }
        
        .chat-messages {
            flex: 1;
            padding: 20px;
            overflow-y: auto;
        }
        
        .message {
            display: flex;
            margin-bottom: 20px;
        }
        
        .avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            margin-right: 12px;
            flex-shrink: 0;
            background-color: #e3f2fd;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #2196F3;
            font-weight: bold;
        }
        
        .message-content {
            max-width: 80%;
        }
        
        .message-user {
            font-weight: 600;
            font-size: 14px;
            color: #2196F3;
            margin-bottom: 4px;
        }
        
        .message-text {
            background-color: #e3f2fd;
            padding: 12px 16px;
            border-radius: 18px;
            border-top-left-radius: 4px;
            font-size: 15px;
            line-height: 1.5;
            color: #333;
        }
        
        .message-system {
            justify-content: center;
        }
        
        .message-system .message-text {
            background-color: #f5f5f5;
            color: #666;
            font-size: 13px;
            padding: 8px 16px;
            border-radius: 16px;
        }
        
        .message-right {
            flex-direction: row-reverse;
        }
        
        .message-right .avatar {
            margin-right: 0;
            margin-left: 12px;
            background-color: #2196F3;
            color: white;
        }
        
        .message-right .message-content {
            text-align: right;
        }
        
        .message-right .message-text {
            background-color: #2196F3;
            color: white;
            border-top-left-radius: 18px;
            border-top-right-radius: 4px;
        }
        
        .chat-input {
            padding: 16px 20px;
            border-top: 1px solid #eee;
            display: flex;
            align-items: center;
        }
        
        .input-box {
            flex: 1;
            border: 1px solid #ddd;
            border-radius: 24px;
            padding: 12px 18px;
            font-size: 15px;
            outline: none;
            resize: none;
            height: 48px;
            max-height: 120px;
            transition: all 0.3s;
        }
        
        .input-box:focus {
            border-color: #2196F3;
            box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
        }
        
        .send-button {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background-color: #2196F3;
            color: white;
            border: none;
            margin-left: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .send-button:hover {
            background-color: #1976D2;
        }
        
        .send-button i {
            font-size: 20px;
        }
    </style>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
</head>
<body>
    <div class="chat-container">
        <div class="chat-header">
            <div class="chat-title">聊天助手</div>
            <div class="tab-switch">
                <div class="tab active">用户消息</div>
                <div class="tab">系统消息</div>
            </div>
        </div>
        
        <div class="chat-messages">
            <!-- 系统消息 -->
            <div class="message message-system">
                <div class="message-text">今天 14:30</div>
            </div>
            
            <!-- 用户消息 -->
            <div class="message message-right">
                <div class="avatar">我</div>
                <div class="message-content">
                    <div class="message-user">我</div>
                    <div class="message-text">你好，请问这个产品有什么功能？</div>
                </div>
            </div>
            
            <!-- 客服消息 -->
            <div class="message">
                <div class="avatar">助</div>
                <div class="message-content">
                    <div class="message-user">助手</div>
                    <div class="message-text">您好！我们的产品主要提供智能客服、自动回复、数据分析等功能，可以帮助您提升客户服务效率。</div>
                </div>
            </div>
            
            <!-- 用户消息 -->
            <div class="message message-right">
                <div class="avatar">我</div>
                <div class="message-content">
                    <div class="message-user">我</div>
                    <div class="message-text">听起来不错，价格是多少？</div>
                </div>
            </div>
            
            <!-- 系统消息 -->
            <div class="message message-system">
                <div class="message-text">今天 14:32</div>
            </div>
            
            <!-- 客服消息 -->
            <div class="message">
                <div class="avatar">助</div>
                <div class="message-content">
                    <div class="message-user">助手</div>
                    <div class="message-text">我们提供多种套餐选择，基础版每月299元，专业版每月599元，企业版需要定制报价。您可以根据需求选择合适的套餐。</div>
                </div>
            </div>
        </div>
        
        <div class="chat-input">
            <textarea class="input-box" placeholder="输入消息..." rows="1"></textarea>
            <button class="send-button">
                <i class="fas fa-paper-plane"></i>
            </button>
        </div>
    </div>

    <script>
        // 切换标签
        const tabs = document.querySelectorAll('.tab');
        tabs.forEach(tab => {
            tab.addEventListener('click', () => {
                tabs.forEach(t => t.classList.remove('active'));
                tab.classList.add('active');
            });
        });
        
        // 输入框自动调整高度
        const inputBox = document.querySelector('.input-box');
        inputBox.addEventListener('input', function() {
            this.style.height = 'auto';
            this.style.height = (this.scrollHeight) + 'px';
        });
        
        // 发送消息
        const sendButton = document.querySelector('.send-button');
        sendButton.addEventListener('click', sendMessage);
        
        inputBox.addEventListener('keypress', function(e) {
            if (e.key === 'Enter' && !e.shiftKey) {
                e.preventDefault();
                sendMessage();
            }
        });
        
        function sendMessage() {
            const message = inputBox.value.trim();
            if (message) {
                // 这里添加发送消息的逻辑
                console.log('发送消息:', message);
                inputBox.value = '';
                inputBox.style.height = '48px';
                
                // 模拟回复
                setTimeout(() => {
                    const messagesContainer = document.querySelector('.chat-messages');
                    const newMessage = document.createElement('div');
                    newMessage.className = 'message';
                    newMessage.innerHTML = `
                        <div class="avatar">助</div>
                        <div class="message-content">
                            <div class="message-user">助手</div>
                            <div class="message-text">感谢您的咨询，我们会尽快为您处理。</div>
                        </div>
                    `;
                    messagesContainer.appendChild(newMessage);
                    messagesContainer.scrollTop = messagesContainer.scrollHeight;
                }, 1000);
            }
        }
    </script>
</body>
</html>